# eric7.EricWidgets.EricApplication

Class implementing a specialized application class.

### Global Attributes

ericApp

### Classes

EricApplication | Eric application class with an object registry.

### Functions

None

## EricApplication

Eric application class with an object registry.

### Derived from

QApplication

### Class Attributes

PaletteRoleMapping

### Class Methods

None

### Methods

EricApplication | Constructor
__setPaletteFromStyleSheet | Private method to set the palette from a style sheet.
getMainWindow | Public method to get a reference to the application main window.
getObject | Public method to get a reference to a registered object.
getPluginObject | Public method to get a reference to a registered plugin object.
getPluginObjectType | Public method to get the type of a registered plugin object.
getPluginObjects | Public method to get a list of (name, reference) pairs of all registered plugin objects.
getStyleIconsPath | Public method to get the path for the style icons.
registerObject | Public method to register an object in the object registry.
registerPluginObject | Public method to register a plugin object in the object registry.
setMainWindow | Public method to set the reference to the application main window.
setStyleSheetFile | Public method to read a QSS style sheet file and set the application style sheet based on its contents.
unregisterPluginObject | Public method to unregister a plugin object in the object registry.
usesDarkPalette | Public method to check, if the application uses a palette with a dark background.
usesSmallScreen | Public method to determine, if the application is used on a small screen.

### Static Methods

None

#### EricApplication (Constructor)

EricApplication(args)

Constructor

args (argparse.Namespace)
  namespace object containing the parsed command line parameters

#### EricApplication.__setPaletteFromStyleSheet

__setPaletteFromStyleSheet(styleSheet)

Private method to set the palette from a style sheet.

styleSheet (str)
  style sheet

#### EricApplication.getMainWindow

getMainWindow()

Public method to get a reference to the application main window.

Return:
  reference to the application main window

Return Type:
  QWidget

#### EricApplication.getObject

getObject(name)

Public method to get a reference to a registered object.

name (str)
  name of the object

Return:
  reference to the registered object

Return Type:
  Any

Raises KeyError:
  raised when the given name is not known

#### EricApplication.getPluginObject

getPluginObject(name)

Public method to get a reference to a registered plugin object.

name (str)
  name of the plugin object

Return:
  reference to the registered plugin object

Return Type:
  Any

Raises KeyError:
  raised when the given name is not known

#### EricApplication.getPluginObjectType

getPluginObjectType(name)

Public method to get the type of a registered plugin object.

name (str)
  name of the plugin object

Return:
  type of the plugin object

Return Type:
  str

Raises KeyError:
  raised when the given name is not known

#### EricApplication.getPluginObjects

getPluginObjects()

Public method to get a list of (name, reference) pairs of all registered plugin objects.

Return:
  list of (name, reference) pairs

Return Type:
  list of (str, any)

#### EricApplication.getStyleIconsPath

getStyleIconsPath(universal=False)

Public method to get the path for the style icons.

universal (bool (optional))
  flag indicating a universal file path (defaults to False)

Return:
  directory path containing the style icons

Return Type:
  str

#### EricApplication.registerObject

registerObject(name, objectRef)

Public method to register an object in the object registry.

name (str)
  name of the object
objectRef (Any)
  reference to the object

Raises KeyError:
  raised when the given name is already in use

#### EricApplication.registerPluginObject

registerPluginObject(name, objectRef, pluginType=None)

Public method to register a plugin object in the object registry.

name (str)
  name of the plugin object
objectRef (Any)
  reference to the plugin object
pluginType (str)
  type of the plugin object

Raises KeyError:
  raised when the given name is already in use

#### EricApplication.setMainWindow

setMainWindow(mainWindow)

Public method to set the reference to the application main window.

mainWindow (QWidget)
  reference to the application main window

#### EricApplication.setStyleSheetFile

setStyleSheetFile(filename)

Public method to read a QSS style sheet file and set the application style sheet based on its contents.

filename (str)
  name of the QSS style sheet file

#### EricApplication.unregisterPluginObject

unregisterPluginObject(name)

Public method to unregister a plugin object in the object registry.

name (str)
  name of the plugin object

#### EricApplication.usesDarkPalette

usesDarkPalette()

Public method to check, if the application uses a palette with a dark background.

Return:
  flag indicating the use of a palette with a dark background

Return Type:
  bool

#### EricApplication.usesSmallScreen

usesSmallScreen()

Public method to determine, if the application is used on a small screen.

Return:
  flag indicating the use of a small screen

Return Type:
  bool

Up